package cn.dm.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

/**
 * @author Sheldor
 * @date 2020/9/12 - 17:29
 */
@EnableWebSecurity
@Configuration
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity htt) throws Exception {
        htt.csrf().disable(); //关闭csrf
        htt.authorizeRequests().anyRequest().authenticated().and().httpBasic(); //开启认证
    }

}
